package com.video.main_video.manager.handle.comment;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.video.main_video.api.Api;
import com.video.main_video.dao.entity.AllCommentEntity;
import com.video.main_video.dao.entity.CommentChild;
import com.video.main_video.dao.request.comment.CommentChildGetListRequest;
import com.video.main_video.dao.response.comment.CommentChildGetListResponse;
import com.video.main_video.manager.handle.ApiHandler;
import com.video.main_video.manager.mapper.CommentChildMapper;
import com.video.main_video.manager.mapper.CommentReplyMapper;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.ArrayList;
import java.util.List;

@Api
public class CommentGetListManager implements ApiHandler<CommentChildGetListRequest, CommentChildGetListResponse> {

    @Autowired
    CommentChildMapper commentChildMapper;
    @Autowired
    CommentReplyMapper replyMapper;
    @Override
    public CommentChildGetListResponse handler(CommentChildGetListRequest commentChildGetListRequest) {

        List<AllCommentEntity> res= DiscussGetList(commentChildGetListRequest.getVideoId());

        CommentChildGetListResponse response=new CommentChildGetListResponse();
        if (res!=null){
            response.setModel(res);
        }else {
            response.setModel(new ArrayList<>());
        }

        response.setCode(200);
        return response;
    }

    private List<AllCommentEntity> DiscussGetList(String videoId){
       

        List<AllCommentEntity> videoComment = commentChildMapper.findVideoComment(videoId);

        return videoComment;
    }
}
